![](https://notabug.org/Tonypythony/Restarting-a-Python-Script-Within-Itself/raw/master/snakeetitself.jpg)

tony $> Desktop $> python3 daemon.py  
i = 0  
i = 1  
i = 0  
i = 1  
i = 0  
i = 1  
i = 0  
i = 1  
i = 0  
i = 1  
i = 0  
i = 1  
i = 0  
i = 1  
i = 0  
i = 1  
...  

## Source

* [Restarting a Python Script Within Itself](https://blog.petrzemek.net/2014/03/23/restarting-a-python-script-within-itself/)